Date formatting and sorting for dates spanning the turn of the century

ABSTRACT

Dates stored in symbolic form in a database are reformatted to permit easy manipulation and sorting of date-related information. Each date in M 1  M 2 , D 1  D 2 , and Y 1  Y 2  format is converted to C 1  C 2 , Y 1  Y 2 , M 1  M 2 , and D 1  D 2  format. To accomplish the conversion, a 10-decade window starting on Y A  Y B  is defined that encompasses all dates in the database. The value of C 1  C 2  is determined by the relative values of Y 1  Y 2  and Y A  Y B . The reformatted date information is particularly useful when the reformatting is in C 1  C 2  Y 1  Y 2  M 1  M 2  D 1  D 2  format, because sorting by date is accomplished using a pure numerical-value sort.

BACKGROUND OF THE INVENTION

This invention relates to the manipulation of information in a database, and, in particular, to the determination of dates in a useful form.

Dates are stored as symbolic representations in computer databases in varying formats. For example, a date may be represented in the numerical representation MM/DD/YY, where MM is a two-digit month designator, DD is a two-digit day designator, and YY is a two-digit year designator (the last two digits of the year). Thus, Dec. 15, 1993 is designated as 12/15/93. A date may also be represented in an alphanumeric form MMM/DD/YY, where MMM is an alphabetic month designator (e.g., DEC for December), and DD and YY are the same as in the numerical form. Dec. 15, 1993 is represented in this format as DEC/15/93.

Such approaches for the representation of dates have worked well since the advent of computer databases, which has occurred in the twentieth century. Dates may be sorted in chronological order using the numerical representations. However, with the turn of the century at Jan. 1, 2000, the representation and utilization of dates becomes more complex. Using the numerical form above, Dec. 15, 2000 is represented as 12/15/00. If a numerical sort is performed on 12/15/93 and 12/15/00, the later date 12/15/00 sorts as the first-occurring date, an incorrect result.

Sets of dates spanning the turn of the century and associated with past, current, and future activities are now stored in many databases. When stored in the conventional formats discussed above, those dates will not readily be used and numerically sorted in chronological order. They may be manually converted to a more usable form in the sense that programs may be written to perform conversions, manipulations, and sorting. However, these programs typically require additional data fields for storage, which may be objectionable in some circumstances.

There is a need for an improved approach to the representation and utilization of dates in databases, and for converting the existing dates in databases to a more usable form. The present invention fulfills this need, and further provides related advantages.

SUMMARY OF THE INVENTION

The present invention provides an approach to the representation and utilization of dates stored symbolically in databases. Existing symbolic date representations are converted to a more useful form of symbolic date representations without the addition of new data fields, and in a manner that is performed automatically by the computer and requires no user input. The approach of the invention permits direct numerical sorting of dates.

In accordance with the invention, a method of processing dates stored in a database comprises the steps of providing a database with dates stored therein according to a format wherein M₁ M₂ is the numerical month designator, D₁ D₂ is the numerical day designator, and Y₁ Y₂ is the numerical year designator, all of the dates falling within a 10-decade period of time. A 10-decade window with a Y_(A) Y_(B) value for the first year of the ten-decade window is selected, Y_(A) Y_(B) being no later than the earliest Y₁ Y₂ year designator in the database. A century designator C₁ C₂ is determined for each date in the database, C₁ C₂ having a first value if Y₁ Y₂ is less than Y_(A) Y_(B) and having a second value if Y₁ Y₂ is equal to or greater than Y_(A) Y_(B) Each date in the database is formatted with the values C₁ C₂, Y₁ Y₂, M₁ M₂, and D₁ D₂.

In the case of most practical interest, the 10-decade period of time spans the year 2000 and begins with a year in which the second digit (Y_(B) in Y_(A) Y_(B)) is 0 (zero). For any 10-decade period including the year 2000, if the decade designator Y₁ of the date in the database is numerically less than the decade designator Y_(A) of the first decade of the 10-decade period of time, the century designator C₁ C₂ is "20". If Y₁ is equal to or greater than Y_(A), C₁ C₂ is "19". Dates in databases spanning more than 10 decades are not handled by this approach, but it is not expected that this limitation will be significant for most commercial and industrial databases.

This approach works particularly well if the dates are represented in the format C₁ C₂ Y₁ Y₂ M₁ M₂ D₁ D₂. The date Dec. 15, 2000 is represented in this format as 20001215, for example. Dates represented in this format may be directly sorted numerically by fast sorting techniques, and thereafter stored back in the database.

The present invention thus provides an efficient approach to converting and utilizing symbolic date representations in databases, which allows automatic processing of dates ranging from before to after the year 2000. The large number of dates represented in some databases may thereby be readily processed and utilized. Other features and advantages of the present invention will be apparent from the following more detailed description of the preferred embodiment, taken in conjunction with the accompanying drawings, which illustrate, by way of example, the principles of the invention. The scope of the invention is not, however, limited to this preferred embodiment.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic representation of a computer database with date information therein; and

FIG. 2 is a block flow diagram of a preferred approach for practicing the approach of the invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 schematically depicts a computer 20 having a read-only or random-access memory 22, a mass-storage device 23, and a central processing unit 24 therein. Stored in the memory 22 or on the mass-storage device 23 is a database 26. The database includes information in the form of symbolic representations of dates and associated information such as events occurring on the respective dates. In a conventional approach, the dates are stored in a format such as M₁ M₂ /D₁ D₂ /Y₁ Y₂ format. M indicates month information, D day information, and Y year information, with the subscript 1 or 2 indicating the first or second digit of the designator, respectively. Dec. 15, 1993 is stored as 12/15/93 or 12-15-93, and Dec. 15, 2000 is stored as 12/15/00 or 12-15-00, for example. If a numerical sort is performed on these dates, 12/15/00 will sort chronologically prior to 12/15/93.

FIG. 2 illustrates the approach of the invention. The computer database 26 is provided, numeral 30, having symbolic representations of dates stored therein. In some cases, the dates will be represented as discussed in the preceding paragraph. In other cases, an alphanumeric designator is used. In that approach, each date is stored as M_(a) M_(b) M_(c) /D₁ D₂ /Y₁ Y₂ format, where M_(a) M_(b) M_(c) is an alphabetical symbol such as JAN for January, FEB for February, etc. In that case, the month designator M_(a) M_(b) M_(c) is first converted to the numerical form M₁ M₂ by converting JAN to "01", FEB to "02", etc.

A 10-decade window is selected, numeral 32. That is, it is necessary that all dates in the database will be within some period of 10 decades, or 100 years. This limitation poses little problem for most industrial and commercial databases. The window may be arbitrarily selected. For example, the decade could begin with the 1950's and end with the 2040's, or it could begin with the 1980's and end with the 2070's. The 10-decade window will normally include some decades from the prior century and some from the new century.

The first year of the 10-decade window is represented by Y_(A) Y_(B). In a commonly utilized application, Y_(B) is 0 (zero), although the invention is not limited to this case. That is, the 1950's first decade would be represented by Y_(A) 0 of "50", and the 1980's first decade would be represented by Y_(A) 0 of "80". For this case, a century designator C₁ C₂ for a date is determined, numeral 34, by comparing the value of Y₁, the first digit of the year designator for the date, with Y_(A), the first digit of the first decade of the 10-decade window. C₁ C₂ is assigned a first value if Y₁ is less than Y_(A) and a second value if Y₁ is equal to or greater than Y_(A).

In the case of most interest, the 10-decade window includes decades earlier than the year 2000 and decades later than the year 2000, and Y_(B) is zero C₁ C₂ is assigned "20" if Y₁ is less than Y_(A) and is assigned "19" if Y₁ is equal to or greater than Y_(A). In that case and for example, if Y_(A) is 5, meaning that the decade beginning in 1950 was selected as the first decade of the 10-decade window, and if Y₁ Y₂ is "43", the century designator C₁ C₂ is "20", indicating that the year in question in the database is 2043. On the other hand, if Y₁ Y₂ is "63", the century designator C₁ C₂ is "19", indicating that the year in question in the database is 1963. This selection process is performed in a completely automated fashion by the computer, without human input other than to select the starting date of the 10-decade window.

The symbolic representations of the dates in the database are reformatted with the values C₁ C₂, Y₁ Y₂, M₁ M₂, and D₁ D₂, numeral 36 of FIG. 2. In one case that produces particularly advantageous results for many operations, such as chronological date sorting, the date is represented in the form C₁ C₂ Y₁ Y₂ M₁ M₂ D₁ D₂. For example, the date 12/15/93 (Dec. 15, 1993) is represented as 19931215 and the date 12/15/00 (Dec. 15, 2000) as 20001215. A straightforward numerical sort of date data fields expressed in this form produces an accurate chronological ordering.

Once the symbolic representations of the dates are reformatted according to the procedures set forth above, the date information may be sorted, numeral 38, or otherwise manipulated, numeral 40, together with the entries associated with the dates. Such manipulation may include handling of data associated with the dates, storing the dates and associated information back in the data base, or other processes.

The approach of the invention has been implemented in a computer program, a copy of which is attached as Exhibit A. This program converts dates both before and after the year 2000.

The present invention provides an effective technique for reformatting symbolic representations of date information that is rapid and automated, and yields new symbolic representations of date information that are particularly amenable to further processing. Although a particular embodiment of the invention has been described in detail for purposes of illustration, various modifications and enhancements may be made without departing from the spirit and scope of the invention. Accordingly, the invention is not to be limited except as by the appended claims. 

What is claimed is:
 1. A method of processing symbolic representations of dates stored in a database, comprising the steps ofproviding a database with symbolic representations of dates stored therein according to a format wherein M₁ M₂ is the numerical month designator, D₁ D₂ is the numerical day designator, and Y₁ Y₂ is the numerical year designator, all of the symbolic representations of dates falling within a 10-decade period of time; selecting a 10-decade window with a Y_(A) Y_(B) value for the first decade of the window, Y_(A) Y_(B) being no later than the earliest Y₁ Y₂ year designator in the database; determining a century designator C₁ C₂ for each symbolic representation of a date in the database, C₁ C₂ having a first value if Y₁ Y₂ is less than Y_(A) Y_(B) and having a second value if Y₁ Y₂ is equal to or greater than Y_(A) Y_(B) ; and reformatting the symbolic representation of the date with the values C₁ C₂, Y₁ Y₂, M₁ M₂ , and D₁ D₂ to facilitate further processing of the dates.
 2. The method of claim 1, wherein the 10-decade window includes the decade beginning in the year
 2000. 3. The method of claim 2, wherein the step of determining includes the step ofdetermining the first value as 20 and the second value as
 19. 4. The method of claim 1, including an additional step, after the step of reformatting, ofsorting the symbolic representations of dates.
 5. The method of claim 1, wherein the step of reformatting includes the step ofreformatting each symbolic representation of a date into the format C₁ C₂ Y₁ Y₂ M₁ M₂ D₁ D₂.
 6. The method of claim 5, including an additional step, after the step of reformatting, ofsorting the symbolic representations of dates using a numerical-order sort.
 7. The method of claim 1, wherein the step of providing a database includes the step ofconverting pre-existing date information having a different format into the format wherein M₁ M₂ is the numerical month designator, D₁ D₂ is the numerical day designator and Y₁ Y₂ is the numerical year designator.
 8. The method of claim 1, wherein the step of selecting includes the step ofselecting Y_(A) Y_(B) such that Y_(B) is 0 (zero).
 9. The method of claim 1, including an additional step, after the step of reformatting, ofstoring the symbolic representation of dates and their associated information back into the database.
 10. The method of claim 9, including the additional step, after the step of reformatting, ofmanipulating information in the database having the reformatted date information therein.
 11. A method of processing dates in a database, comprising the steps ofproviding a database with dates stored therein according to a format wherein M₁ M₂ is the numerical month designator, D₁ D₂ is the numerical day designator, and Y₁ Y₂ is the numerical year designator, all of dates falling within a 10-decade period of time which includes the decade beginning in the year 2000; selecting a 10-decade window with a Y_(A) Y_(B) value for the first decade of the window, Y_(A) Y_(B) being no later than the earliest Y₁ Y₂ year designator in the database; determining a century designator C₁ C₂ for each date in the database, C₁ C₂ having a first value if Y₁ Y₂ is less than Y_(A) Y_(B) and having a second value if Y₁ Y₂ is equal to or greater than Y_(A) Y_(B) ; reformatting each date in the form C₁ C₂ Y₁ Y₂ M₁ M₂ D₁ D₂ to facilitate further processing of the dates; and sorting the dates in the form C₁ C₂ Y₁ Y₂ M₁ M₂ D₁ D₂.
 12. The method of claim 11, wherein the step of providing a database includes the step ofconverting pre-existing date information having a different format into the format wherein M₁ M₂ is the numerical month designator, D₁ D₂ is the numerical day designator and Y₁ Y₂ is the numerical year designator.
 13. The method of claim 11, wherein the step of selecting includes the step ofselecting Y_(A) Y_(B) such that Y_(B) is 0 (zero).
 14. The method of claim 11, including an additional step, after the step of sorting, ofstoring the sorted dates and their associated information back into the database.
 15. The method of claim 14, including the additional step, after the step of sorting, ofmanipulating information in the database having the reformatted date therein. 